import { Column, Entity, ManyToOne } from 'typeorm';
import { UserWeapon } from '../../user-weapon/entities/user-weapon.entity';
import { WeaponUp } from '../../weapon-up/entities/weapon-up.entity';
import { Shop } from '../../shop/entities/shop.entity';
import { Recharge } from '../../recharge/entities/recharge.entity';
import { User } from '../../../admin/user/entities/user.entity';
import { Weapon } from '../../weapon/entities/weapon.entity';
import { CommonSelectEntity } from '../../../../util/entity/common-select.entity';

@Entity('dnf_record')
export class Record extends CommonSelectEntity {
  // 哪位用户
  @ManyToOne(() => User)
  user: User;
  // 用户强化记录
  @ManyToOne(() => UserWeapon)
  userWeapon: UserWeapon;

  @ManyToOne(() => Weapon)
  weapon: Weapon;

  // 用户强化多少记录
  @ManyToOne(() => WeaponUp)
  weaponUp: WeaponUp;

  // 强化是否成功记录,也可以表示其他成功
  @Column({ type: 'tinyint', default: 1, comment: '是否强化成功1-成功 0-失败' })
  success: number;

  @Column({ default: '', comment: '错误信息' })
  errorMessage: string;

  // 购物记录
  @ManyToOne(() => Shop)
  shop: Shop;

  // 充值记录
  @ManyToOne(() => Recharge)
  recharge: Recharge;

  @Column({
    default: 1,
    comment: '1-购买物品 2-充值兑换 3-购买武器 4-增幅武器 5-武器被销毁',
  })
  type: number;
}
